<?php

/**
 * My Application bootstrap file.
 */

error_reporting(E_ALL);
ini_set("display_errors", 1); 

use Nette\Diagnostics\Debugger,
	Nette\Application\Routers\Route,
        Nette\Application\Routers\RouteList;


// Load Nette Framework
$params['libsDir'] = __DIR__ . '/../libs';
require $params['libsDir'] . '/Nette/loader.php';


// Enable Nette Debugger for error visualisation & logging
Debugger::$logDirectory = __DIR__ . '/../log';
Debugger::$strictMode = TRUE;
Debugger::enable();


// Load configuration from config.neon file
$configurator = new Nette\Configurator;
$configurator->container->params += $params;
$configurator->container->params['tempDir'] = __DIR__ . '/../temp';
$container = $configurator->loadConfig(__DIR__ . '/config.neon');

//dibi::connect(array(
//    'driver'   => 'mysql',
//    'host'     => 'localhost',
//    'username' => 'root',
//    'password' => '',
//    'database' => 'overfish',
//));

// Setup router
$router = $container->router;
$router[] = new Route('index.php', 'Homepage:default', Route::ONE_WAY);


$router[] = $adminRouter = new RouteList('Admin');
            $adminRouter[] = new Route('admin/<presenter>/<action>[/<id>]', 'Dashboard:default');


            $router[] = $frontRouter = new RouteList('Front');
            
            $frontRouter[] = new \OverFish\Routers\MenuRouter($container);
            $frontRouter[] = new \OverFish\Routers\ArticleRouter($container);


// Configure and run the application!
$application = $container->application;
//$application->catchExceptions = TRUE;
$application->errorPresenter = 'Error';
$application->run();
